<style>
    a:hover{
        color: #040404;
    }
</style>
<script>
  $(function() {
      $( "#txtfrom" ).datepicker({
          changeMonth: true,
			changeYear: true,
			showOn: "button",
			buttonImage: "icon/calendar.gif",
			buttonImageOnly: true
                        
		});
                
       $( "#txtto" ).datepicker({
          changeMonth: true,
			changeYear: true,
			showOn: "button",
			buttonImage: "icon/calendar.gif",
			buttonImageOnly: true
                        
		});
    
  
  });
  </script>
<div style="width: 630px;">
    <div style="margin-bottom: 40px">
        <form action="<?php echo Yii::app()->request->baseUrl; ?>/tim-van-ban-phap-luat" method="post">
            <div >
                <table style="border: 0px;">
                    <tr style="height: 45px">
                        <td colspan="4">
                            <input type="text" name="txttitle"  placeholder="nhập từ khóa tìm kiếm" style="width: 500px">
                        </td>
                        <td>
                            <input type="submit" value="Tìm kiếm">
                        </td>
                    </tr>
                    <tr style="height: 45px">
                        <td>Ban hành từ</td>
                        <td><input type="text" name="txtfrom" id="txtfrom" class="easyui-datebox" data-options="formatter:myformatter,parser:myparser" ></td>
                        <td>đến</td>
                        <td><input type="text" name="txtto" id="txtto" class="easyui-datebox" data-options="formatter:myformatter,parser:myparser" ></td>
                        <td></td>
                    </tr >
                    <tr style="height: 45px">
                        <td>Loại văn bản</td>
                        <td colspan="4">
                            <?php
                            $category_ = Loaivanban::model()->findAll('flag=1');
                            $list_ = CHtml::listData($category_, 'id', 'name');
                            echo CHtml::dropDownList('drloai', '', $list_, array('style' => 'width:330px'));
                            ?>
                        </td>
                    </tr>
                    <tr style="height: 45px">
                        <td>Cơ quan ban hành</td>
                        <td colspan="4">
                            <?php
                            $list = Coquan::model()->findAll('parent =0 ');

                            $arr = array();

                            foreach ($list as $item) {

                                $catelist = Coquan::model()->findAll('parent = ' . $item->id);

                                $arr[$item->id] = $item->name;

                                foreach ($catelist as $it) {
                                    $arr[$it->id] = ' + ' . $it->name;
                                }
                            }

                            echo CHtml::dropDownList('drcoquan', '', $arr, array('style' => 'width:330px'));
                            ?>
                        </td>
                    </tr>
                </table>
            </div>
        </form>
    </div>
    <?php
    if(isset($sql)){
        echo $sql;
    }
    $lan = 0;
    if (!empty($model)) {
        foreach ($model as $item) {
            $lan = $lan + 1;
            ?>
    
    <div>
            <div class="number">
                <?php echo $lan; ?>
            </div>
            <div class="nq">
                <a href="<?php echo Yii::app()->request->baseUrl . '/van-ban/' . $item->id . '/' . $item->url; ?>">
                    <?php echo $item->tieude; ?>
                </a>
            </div>
    </div>
    <div class="clear"></div>
            <?php
        }
    }
    ?>
</div>   <script type="text/javascript">
    function myformatter(date) {
        var y = date.getFullYear();
        var m = date.getMonth() + 1;
        var d = date.getDate();
        return y + '-' + (m < 10 ? ('0' + m) : m) + '-' + (d < 10 ? ('0' + d) : d);
    }
    function myparser(s) {
        if (!s)
            return new Date();
        var ss = (s.split('-'));
        var y = parseInt(ss[0], 10);
        var m = parseInt(ss[1], 10);
        var d = parseInt(ss[2], 10);
        if (!isNaN(y) && !isNaN(m) && !isNaN(d)) {
            return new Date(y, m - 1, d);
        } else {
            return new Date();
        }
    }
</script>

<div class="clear"></div>
</div>
<div class="clear"></div>
</div>
<div class="clear"></div>

<div id="to"></div>
<div class="clear"></div>
</div>

<div class="clear"></div>
